<?php
/**
 * IG_Untitled静态方法集
 *
 * @author maomao.thx@gmail.com
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: Untitled.php 638 2011-06-17 09:07:00Z maomao.thx@gmail.com $
 */
class IG_Untitled
{
    private static $_cacheVersion = '001';

    /**
     * 保存缓存
     * @param string $key
     * @param mix $value
     */
    public static function memcacheSave($key, $value)
    {
        $frontendOptions = array(
            'lifetime' => 12 * 7200 ,  // cache lifetime of 2 hours
            'automatic_serialization' => true
        );

        $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions);
        $cache->save(1, $key);
    }

    /**
     * 加载Memcache的缓存
     * @param string $key
     */
    public static function memcacheLoad($key)
    {
        $frontendOptions = array(
            'lifetime' => 12 * 7200 ,  // cache lifetime of 2 hours
            'automatic_serialization' => true
        );

        $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions);

        if(null === ($res = $cache->load($key))) {
            return false;
        }
        return $res;
    }
}